package com.jeesite.modules.wzt.util;

import com.alibaba.fastjson.JSON;
import com.banboocloud.Codec.Sm3Signature;
import com.banboocloud.Codec.Sm4Cipher;

import java.util.HashMap;
import java.util.Map;

public class EncryptTest {
    public static void main(String[] args) {
        //sm3签名
        String originalStr = "userId=1";
        Sm3Signature signature = new Sm3Signature();
        String signatureStr = signature.signature(originalStr);

        //sm4加解密
        String key = "JLB6L6MJVIT5Z7IL";
        Sm4Cipher sm4Cipher = new Sm4Cipher();
        String pwd ="WZT_whdc@123";
        String user ="USER_whdc_123";
        Map map = new HashMap<>();
        map.put("bimRemotePwd","WZT_whdc@123");
        map.put("bimRemoteUser","USER_whdc_123");
        map.put("signature","7bcce7825a49bb524188972518c48dd0cf9dc647e7eb6340c2af948ea8fc0a14");
        map.put("bimRequestId","9e928d12ec8a4c1bb75283b8df71308d");
        map.put("fullname","昂璐");
        map.put("gender","1");
        map.put("username","15005537599");

        map.put("mobile","15005537599");
        map.put("organizitionId","20220813101016352-AA4A-52107DFE1");
        map.put("userid","ohc-2023-3-281111");
        map.put("relation","ohc-2023-3-28");



        String source = JSON.toJSONString(map);
        String target = sm4Cipher.encrypt(source, key);

        //输出密文
         String type = "SM4";
        System.out.println("target:" + target);
        String  aa  = BamboocloudUtils.getPlaintext("htps7xRJRfgxgsmofJERTlcdOJuOg5xSyqgMViFGfTqDDcVsz2yYXxFQf6kX1V0Ka36gTrCZl2IBeh9Ox9G2Bg==", key, type);
        System.out.println("aa:" + aa);
    }

    public void createuser(){
        Map map = new HashMap<>();
        map.put("bimRequestId","9e928d12ec8a4c1bb75283b8df71308d");
        map.put("fullname","测试1");
        map.put("gender","男");
        map.put("username","17612129438");

        map.put("mobile","15715537059");
        map.put("organizationId","20230311203956955-AF88-D1FFF8970");
        map.put("userid","ohc-2023-3-28");
    }

    public void updateuser(){
        Map map = new HashMap<>();
        map.put("fullname","测试1");

        map.put("bimUid","19698");

    }

    public void updateOrg(){
        Map map = new HashMap<>();
        map.put("__ENABLE__",false);
        map.put("bimOrgId","1641257629916553216");
        map.put("bimRemotePwd","WZT_whdc@123");
        map.put("bimRemoteUser","USER_whdc_123");
        map.put("bimRequestId","a674b20665b748c6aa9b4aa4a0900661");
        map.put("signature","7bcce7825a49bb524188972518c48dd0cf9dc647e7eb6340c2af948ea8fc0a14");


    }


    public void createAsg(){
        Map map = new HashMap<>();
        map.put("userId","20230303100224101-61C8-6515AB6BE");
        map.put("bimRemotePwd","WZT_whdc@123");
        map.put("bimRemoteUser","USER_whdc_123");
        map.put("bimRequestId","a674b20665b748c6aa9b4aa4a0900661");
        map.put("signature","7bcce7825a49bb524188972518c48dd0cf9dc647e7eb6340c2af948ea8fc0a14");
        map.put("organizationId","20220621093304204-298E-C2C80C661");
        map.put("unitId","20220621093304204-298E-C2C80C661");
        map.put("orgPath","地（市）/null/芜湖市政府机构/安徽省芜湖市教育局/芜湖师范学校/芜湖师范学校附属幼儿园");
        map.put("relation","BELONG");
        map.put("title","主任、一级调研员");
        map.put("phone","18330888888");

    }


    public void queryAsg(){
        Map map = new HashMap<>();
        map.put("userId","20230303100224101-61C8-6515AB6BE");
        map.put("bimRemotePwd","WZT_whdc@123");
        map.put("bimRemoteUser","USER_whdc_123");
        map.put("bimRequestId","a674b20665b748c6aa9b4aa4a0900661");
        map.put("signature","7bcce7825a49bb524188972518c48dd0cf9dc647e7eb6340c2af948ea8fc0a14");

    }
    public void updateAsg(){
        Map map = new HashMap<>();
        map.put("userId","20230303100224101-61C8-6515AB6BE");
        map.put("bimRemotePwd","WZT_whdc@123");
        map.put("bimRemoteUser","USER_whdc_123");
        map.put("bimRequestId","a674b20665b748c6aa9b4aa4a0900661");
        map.put("signature","7bcce7825a49bb524188972518c48dd0cf9dc647e7eb6340c2af948ea8fc0a14");
        map.put("organizitionId","20220621093304204-298E-C2C80C661");
        map.put("isDelete","1");

    }
}
